﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace Mindfor.Error
{
	/// <summary>
	/// Contains information about exception occured in remote application.
	/// </summary>
	[Serializable]
	[XmlRoot("exception")]
	public class ExceptionInfo
	{
		/// <summary>
		/// Gets or sets exception type full name.
		/// </summary>
		[XmlElement("type")]
		public string Type { get; set; }
		
		/// <summary>
		/// Gets or sets message.
		/// </summary>
		[XmlElement("message")]
		public string Message { get; set; }

		/// <summary>
		/// Gets or sets stack trace.
		/// </summary>
		[XmlElement("stackTrace")]
		public string StackTrace { get; set; }

		/// <summary>
		/// Initializes new instance.
		/// </summary>
		public ExceptionInfo()
		{
		}

		/// <summary>
		/// Initializes new instance.
		/// </summary>
		/// <param name="ex">Exception to get info from.</param>
		public ExceptionInfo(Exception ex)
		{
			Type = ex.GetType().FullName;
			Message = ex.Message;
			StackTrace = ex.StackTrace;
		}
	}
}
